<!DOCTYPE html>
<head>
    <title>
       slot插槽 
    </title>
<script src="vue.js"></script>
</head>
<body>
<div id = "app">
    <todo>
    <todo-title slot="todoTitle" :title="title"></todo-title>
    <todo-item slot="todoItem" v-for="item in todoItems" :item="item"></todo-item>
    </todo>
</div>
<script type="text/javascript">
    Vue.component("todo",{
        template : '<div>\
            <slot name="todoTitle"></slot>\
            <ul>\
                <slot name="todoItem"></slot>\
            </ul>\
            </div>'
    });
    Vue.component('todo-title',{
        props: ['title'],
        template: '<div>{{ title }}</div>'
    });
    Vue.component("todo-item",{
        props: ['item'],
        template : '<li>{{ item }}</li>'
    });
    var vm = new Vue({
        el : "#app",
        data : {
            title : "学习",
            todoItems: ['python', 'linux', '前端', '后端']
       },
        methods:{
        }
    });
</script>
<style type='text/css'>
    .test{color:cyan}
    .big{font-size:30px;}
    .active{background:red}
</style>
</body>
